home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / nodee1a.arc / SOURCE.ARC / NODCL.CPP < prev    next >
Text File  |  1991-09-20  |  2KB  |  93 lines

  1. /*
  2.  
  3. NODCL.CPP
  4. version 1.1
  5.  
  6. Command line version of No ^D program.
  7. This program will remove the ^D from the first line of a Postscript
  8. file.  Since it is a Windows program, it can be set up as an association
  9. and used easily from the file manager.
  10.  
  11. written by James D. Rudnicki
  12. jdrudnicki@lbl.gov
  13. last update Septmeber 1991
  14.  
  15. written with Borland C++ 2.0 */
  16.  
  17.  
  18. // Access the libraries needed
  19.  
  20.     #if !defined(__WINDOWS_H)
  21.         #include <windows.h>
  22.     #endif
  23.  
  24.     #include <stdlib.h>
  25.     #include <stdio.h>
  26.     #include <iostream.h>
  27.     #include <fstream.h>
  28.  
  29.  
  30.     #ifndef __STRING_H
  31.         #include <string.h>
  32.     #endif
  33.  
  34.     #ifndef __DIR_H
  35.         #include <dir.h>
  36.     #endif
  37.  
  38. // symbol table
  39.  
  40.     #ifndef __NOD1_H
  41.         #include "nod1.h"
  42.     #endif
  43.  
  44.     #ifndef __PS_H
  45.         #include "ps.h"
  46.     #endif
  47.  
  48. /*-------------------------------------------------------------
  49.     No Window is opened by this program.  All proccesing takes place
  50. in WinMain.
  51.  
  52. The command line should contain a file name.
  53. The program will search for the file in the current directory or
  54. anywhere on the PATH.  If it is not found there, it will change to
  55. the directory defined in the private profile file, PRIVATEINI.
  56. If the file is found, it is tested to determine if it is a
  57. Postscript file with a ^D on the first line.  If it is, the ^D is
  58. removed.
  59.  
  60. -------------------------------------------------------------*/
  61.  
  62.  
  63.     int PASCAL WinMain
  64.         (HANDLE hInstance,HANDLE hPrev,LPSTR lpszCmdLine,int nCmdShow)
  65.     {
  66.         char szDefDir[MAXPATH];
  67.         char szNearCmd[MAXPATH];
  68.  
  69.         _fstrcpy((char * far)szNearCmd,lpszCmdLine);
  70.  
  71.         PSFile A;
  72.  
  73.         if (A.SetFile(szNearCmd))
  74.         {
  75.             if(A.test())
  76.                 if(1==A.strip())
  77.                     MessageBox(NULL,"File Cleaned","No ^D",MB_OK);
  78.         }
  79.         else
  80.         {
  81.             GetPrivateProfileString
  82.                 ("NoDee","DefDir","",szDefDir,MAXPATH,PRIVATEINI);
  83.  
  84.             if (0==chdir(szDefDir))
  85.                 if (A.SetFile(szNearCmd))
  86.                     if(A.test())
  87.                         if(1==A.strip())
  88.                             MessageBox(NULL,"File Cleaned","No ^D",MB_OK);
  89.         }
  90.         return 0;
  91.     }
  92.  
  93.